//
//  CycleScrollView.h
//  Charles
//
//  Created by Charles on 2017/2/7.
//  Copyright © 2017年 charles. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol CycleScrollViewDataSource;
@protocol CycleScrollViewDelegate;

@interface CycleScrollView : UIView <UIScrollViewDelegate>

@property (nonatomic, strong, readonly) UIScrollView *scrollView;
/**
 *  当前行
 */
@property (nonatomic, assign) NSInteger index;
@property (nonatomic, assign) id<CycleScrollViewDelegate> delegate;
@property (nonatomic, assign) id<CycleScrollViewDataSource> dataSource;

/**
 *  重新加载数据
 */
- (void)reloadData;

@end


@protocol CycleScrollViewDataSource <NSObject>

@required
/**
 *  rows 行数
 *
 *  @param cycleScrollView CycleScrollView
 *
 *  @return 行数
 */
- (NSInteger)numberOfRowsInCycleScrollView:(CycleScrollView *)cycleScrollView;
/**
 *  行内容
 *
 *  @param cycleScrollView CycleScrollView
 *  @param index           行坐标
 *
 *  @return UIView
 */
- (UIView *)cycleScrollView:(CycleScrollView *)cycleScrollView viewForRowAtIndex:(NSInteger)index;

@end

@protocol CycleScrollViewDelegate <NSObject>

@optional
/**
 *  当前选中，回调
 *
 *  @param cycleScrollView CycleScrollView
 *  @param index           行坐标
 */
- (void)cycleScrollView:(CycleScrollView *)cycleScrollView didSelectedAtIndex:(NSInteger)index;

@end
